package com.xkcyy.study.spring.d02_aop;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;

/**
 * SpringBootStudyApplication
 *
 * @author yuand
 * @date 2021/5/6
 **/
@SpringBootApplication
@EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class})
public class D_02_Aop_Application implements CommandLineRunner, BeanFactoryAware {
    private BeanFactory beanFactory;

    public static void main(String[] args) {

        SpringApplication.run(D_02_Aop_Application.class, args);
    }

    @Autowired
    UserService service;


    @Override
    public void run(String... args) throws Exception {
        service.get();
    }

    @Override
    public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
        this.beanFactory = beanFactory;
    }
}
